-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve slime connection on Windows #385
Conversation
modes/lisp-mode/lisp-mode.lisp
Outdated
@@ -1254,10 +1252,15 @@ | |||
'highlight-evaluation-region) | |||
|
|||
;; workaround for windows | |||
;; (quit slime and close sockets to exit lem normally) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
関数を定義してコメントではなくdocstringに書くと良いと思います。
終了処理を見直ししました。docstring も書いてみました。 usocket の件は、一応報告してみました。 |
どうもソケットをクローズすると、まれに以下のエラーが出ることがあったため、
終了できないことがある件については、また別の機会に調べてみます。。。 |
swank:close-connectionについてはちょっと待ってあげないといけない気はしますね。 |
うーむ。sleep を入れるとエラーは出なくなりましたが、 そもそも (uiop:quit) を送っているので、 |
いくつか改善をしました。
|
swank server との接続の setup のところで、 これによって、swank-repl モジュールのロード完了を、正常に待てるようになったため、 (lem を終了できないことがある件は、そのままです。。。) |
Windows 上 で M-x slime を実行すると、固まったり、
応答が表示されなかったり、終了できなくなったりする件を、改善してみました。
message-waiting-p ( modes/lisp-mode/swank-protocol.lisp ):
Windows 版の sbcl では、
usocket:wait-for-input を呼び出す前にイベントオブジェクトをリセットしないと、
2回目以降の usocket:wait-for-input で、ウェイトしなくなってしまう。
このため、WSAResetEvent でイベントオブジェクトをリセットするようにした。
(本現象は、usocket:wait-for-input の引数にソケットを1個だけ指定したときに発生する。
ソケットが1個だけのときは、内部情報 (wait-list) を毎回作らないで使いまわすようになっており、
イベントオブジェクトも使いまわしになるためリセットが必要だった。。。
https://github.com/usocket/usocket/blob/2b92b917cf9bd763492461b5b9814e801d1b063f/usocket.lisp#L348 )
port-available-p ( modes/lisp-mode/util.lisp ):
usocket:socket-listen のところで、
:reuse-address t を指定しているが、
複数プロセスが同一ポートで待ち受けして変になるケースがあったため、
:reuse-address nil に変更した。
start-thread ( modes/lisp-mode/lisp-mode.lisp ):
Reduce cpu usage in lisp-mode on Windows #378 の (sleep 0.001) は不要になったため削除した。
handler-case の範囲を広げた。
(終了時に最大10秒固まったため)
add-hook *exit-editor-hook*
( modes/lisp-mode/lisp-mode.lisp ):ソケットクローズを追加した。